package com.example.demo.hot;

/**
 * @Classname AddTwoNumbers
 * @Description
 * @Date 2023/10/27 17:05
 * @Created by jyl
 */
public class AddTwoNumbers {

    //输入：l1 = [2,4,3], l2 = [5,6,4]
    //输出：[7,0,8]
    //解释：342 + 465 = 807.
    //示例 2：
    //
    //输入：l1 = [0], l2 = [0]
    //输出：[0]
    //示例 3：
    //
    //输入：l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]
    //输出：[8,9,9,9,0,0,0,1]
    //提示：
    //
    //每个链表中的节点数在范围 [1, 100] 内
    //0 <= Node.val <= 9
    //题目数据保证列表表示的数字不含前导零


    public static void main(String[] args) {
        int ia[] = {1,2,3};
        int ib[] = {3,4,5};

        int sum = 0;
        sum = Integer.parseInt(getSums(ia)) + Integer.parseInt(getSums(ib));
        System.out.println(sum);
    }

    public static String getSums(int[] array){
        StringBuilder str = new StringBuilder();
        for (int i = array.length; i > 0; i--) {
            str.append(array[i-1]);
        }
        return str.toString();
    }





}
